

//加载预加载部分代码
function loadready() {
    //服务类型的遮罩
    var o = document.getElementById("div1");
    var w = o.clientWidth || o.offsetWidth;
    var h = o.clientHeight || o.offsetHeight;
    var zhezhao = document.getElementsByClassName("zhezhao");
    for(var i = 0; i < zhezhao.length; i++) {
        zhezhao[i].style.height = h + "px";
        zhezhao[i].style.width = w + "px";
    }
}

//加载经典案例部分代码
function loadclassic() {
    $.ajax({
        type:"get",
        url:"/classicCase/getClassicList",
        contentType: "application/json;charset=utf-8",
        dataType: 'json',
        data:{currPage:1,pageSize:9},
        success: function (data) {

            for (var i = 0;i < data.datas.length; i++) {

                var jdaldiv = document.createElement("div");
                jdaldiv.id = data.datas[i].classicId;
                jdaldiv.className = "col-xs-6 col-sm-4 jdal-jgg";
                jdaldiv.innerHTML = "<img id='div2' src='" + data.datas[i].img + "' class='img-responsive' alt='Cinque Terre '/>" +
                    "<a class='jdal-bt'>" + data.datas[i].name + "</a>";
                document.getElementById("jdalnews").appendChild(jdaldiv);
                //给创建的div添加点击事件
                document.getElementById(data.datas[i].classicId).addEventListener("click",function(){classic(this)});
            }

//                        经典案例的遮罩
//             var o1 = document.getElementById("div2");
//             var w1 = o1.clientWidth || o.offsetWidth;
//             var h1 = o1.clientHeight || o.offsetHeight;
//
//             var zhezhao1 = document.getElementsByClassName("zhezhao1");
//             for(var i = 0; i < zhezhao1.length; i++) {
//                 zhezhao1[i].style.height = h1 + "px";
//                 zhezhao1[i].style.width = w1 + "px";
//             }
        },
        error: function (res) {
            console.log(res.readyState + "  " + res.responseText);
            alert("请求失败！");
        }
    });
}

//加载行业聚焦部分代码
function loadhyjj() {
    $.ajax({
        type:"get",
        url:"/news/getTypeOne",
        contentType: "application/json;charset=utf-8",
        dataType: 'json',
        success: function (data) {

            for (var i = 0;i < data.datas.length && i < 6; i++) {

                var description = data.datas[i].newsContent;
                description = description.replace(/<\/?[^>]*>/g, "");

                var hyjjdiv = document.createElement("div");
                hyjjdiv.id = data.datas[i].newsId;
                hyjjdiv.className = "new1 col-xs-12 col-sm-6";
                hyjjdiv.innerHTML = "<img src='" + data.datas[i].newsImg + "' class='img-responsive col-xs-6 col-sm-6' />" +
                    "<div class='col-xs-6 col-sm-6'>" +
                    "<h5>" + data.datas[i].newsTitle + "</h5>" +
                    "<p class='col-xs-12 col-sm-12 hidden-xs'>" + description + "</p>" +
                    "<dl class='col-xs-12 col-sm-12'>" + data.datas[i].createTime + "</dl>" +
                    "</div>";
                document.getElementById("home").appendChild(hyjjdiv);
                //给创建的div添加点击事件
                document.getElementById(data.datas[i].newsId).addEventListener("click",function(){xwxq(this)});

            }
        },
        error: function (res) {
            console.log(res.readyState + "  " + res.responseText);
            alert("请求失败！");
        }
    });
}

//加载企业动态部分代码
function loadqydt() {
    $.ajax({
        type:"get",
        url:"/news/getTypeTwo",
        contentType: "application/json;charset=utf-8",
        dataType: 'json',
        success: function (data) {

            for (var i = 0;i < data.datas.length && i < 6; i++) {

                var description = data.datas[i].newsContent;
                description = description.replace(/<\/?[^>]*>/g, "");

                var qydtdiv = document.createElement("div");
                qydtdiv.id = data.datas[i].newsId;
                qydtdiv.className = "new2 col-xs-12 col-sm-6";
                qydtdiv.innerHTML = "<img src='" + data.datas[i].newsImg + "' class='img-responsive col-xs-6 col-sm-6' />" +
                    "<div class='col-xs-6 col-sm-6'>" +
                    "<h5>" + data.datas[i].newsTitle + "</h5>" +
                    "<p class='col-xs-12 col-sm-12 hidden-xs'>" + description + "</p>" +
                    "<dl class='col-xs-12 col-sm-12'>" + data.datas[i].createTime + "</dl>" +
                    "</div>";
                document.getElementById("qydt").appendChild(qydtdiv);
                //给创建的div添加点击事件
                document.getElementById(data.datas[i].newsId).addEventListener("click",function(){xwxq(this)});

            }
        },
        error: function (res) {
            console.log(res.readyState + "  " + res.responseText);
            alert("请求失败！");
        }
    });
}

//加载招聘信息部分代码
function loadrecruit() {
    $.ajax({
        type: "GET",
        url: "/recruit/getRecruitList",
        contentType: "application/json;charset=utf-8",
        dataType: 'json',
        success: function (data) {
            for (var i = 0; i < data.datas.length; i++) {
                var recruiBodyDiv = document.createElement("div");
                recruiBodyDiv.className = "recruitbody";
                recruiBodyDiv.innerHTML = "<div class='colbody'>" + data.datas[i].recruitDepart + "</div>" +
                    "<div class='colbody'>" + data.datas[i].recruitPosition + "</div>" +
                    "<div class='colbody'>" + data.datas[i].recruitLocation + "</div>" +
                    "<div class='colbody'><a>查看详情</a></div>" +
                    "<div class='colbody'>" + data.datas[i].recruitTime + "</div>";
                document.getElementById("recruitDd").appendChild(recruiBodyDiv);

//                    创建隐藏部分
                var recruitHideDIv = document.createElement("div");
                recruitHideDIv.className = "recruithide";
                recruitHideDIv.innerHTML = "<div class='recruitterm'>" +
                    "<span class='recruitspan'>招聘人数：" + data.datas[i].recruitNumber + "人</span>" +
                    "<span class='recruitspan'>工作经验：" + data.datas[i].recruitExperience + "</span>" +
                    "</div>" +
                    "<div class='recruitgwzz'>" +
                    "<span class='gangweizhize'>岗位职责</span>" +
                    "<p>123456<br/>123</p>" +
                    "</div>" +
                    "<div class='recruitgwzz'>" +
                    "<span class='gangweizhize'>任职要求</span>\n" +
                    "<p>123<br/>12345</p>\n" +
                    "</div>";
                document.getElementById("recruitDd").appendChild(recruitHideDIv);
                $(".recruitbody").click(function(){
                    $(".recruithide").css("display","none");
                    $(this).next(".recruithide").css("display","block");
                });
            }
        },
        error: function (res) {
            console.log(res.readyState + "  " + res.responseText);
            alert("请求失败！");
        }
    });
}